<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>location对象</title>
  <style>
  
  
  </style>
</head>
<body>
  <button id="box">点击</button>
  <script>
    var btn = document.querySelector("#box");
    btn.addEventListener('click',function (){
      console.log('location href: ' + location.href);
      console.log('location search: ' + location.search);
      console.log('location hash: ' + location.hash);
    })
    
  </script>
</body>
</html>